package main

import (
	"fmt"
	"jaegerDemo/rabbitmq/demo/vender"
)

func main() {
	rb := vender.Rabbitmq{
		Address:   "amqp://guest:123456@localhost:5672/",
		QueueName: "rabbitmq_demo",
		MaxRetry:  3,
	}
	if err := rb.InitRabbitmq(); err != nil {
		panic(err)
	}
	defer rb.Close()
	// 创建默认队列
	if err := rb.DefaultQueue(); err != nil {
		panic(err)
	}
	for i := 0; i < 100; i++ {
		// time.Sleep(1 * time.Second)
		body := fmt.Sprintf("hello demo, %v", i)
		if err := rb.DefaultProducer("json", []byte(body)); err != nil {
			panic(err)
		}
		fmt.Println("投入消息:", body)
	}

}
